package com.yndsoft.jc.supplier.info;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.yndsoft.jc.R;
import com.yndsoft.jc.supplier.base.SupplierBaseActivity;
import com.yndsoft.jc.supplier.utils.Constants;

public class PersonalActivity extends SupplierBaseActivity implements View.OnClickListener {

    private String tag;
    private ImageView personalHead;

    @Override
    public int getContentResId() {
        return R.layout.activity_personal;
    }

    public static void start(Context context, String tag) {
        Intent intent = new Intent(context, PersonalActivity.class);
        intent.putExtra(Constants.TAG, tag);
        context.startActivity(intent);
    }

    @Override
    public void initView() {
        ImageButton barBack = findViewById(R.id.bar_back);
        TextView barTitle = findViewById(R.id.bar_title);
        personalHead = findViewById(R.id.personal_head);

        barTitle.setText("个人资料");
        barBack.setOnClickListener(this);
    }

    @Override
    public void initData() {
        tag = getIntent().getStringExtra(Constants.TAG);
        if (tag != null) {
            if (tag.equals(Constants.SIGN)) {
                Glide.with(mContext).load(R.mipmap.sign_img).into(personalHead);
            } else if (tag.equals(Constants.ENTRY)) {
                Glide.with(mContext).load(R.mipmap.entry_img).into(personalHead);
            }
        }

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bar_back:
                finish();
                break;
        }
    }
}
